package com.p2p.front.web.form;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import com.p2p.base.page.PageVo;
import com.p2p.base.util.DateUtil;

/**
 * leiwen@yiqihao.com
 */
public class LoanPageVo extends PageVo {

	private String time;

	private String term;

	private String maxDate;

	private Integer minDeadline;

	private Integer maxDeadline;

	private Integer front;
	
	public void init() {
		Date d = DateUtil.addDay(new Date(), 100);
		if (StringUtils.isNotBlank(time)) {
			if (time.equals("1")) {
				d = DateUtil.addDay(new Date(), 1);
			} else if (time.equals("3")) {
				d = DateUtil.addDay(new Date(), 3);
			} else if (time.equals("7")) {
				d = DateUtil.addDay(new Date(), 7);
			}
			maxDate = d.getTime() + "";
		}
		if (StringUtils.isNoneBlank(term)) {
			if (term.equals("1")) {
				this.maxDeadline = 1;
				this.minDeadline = 1;
			} else if (term.equals("2")) {
				this.maxDeadline = 3;
				this.minDeadline = null;
			} else if (term.equals("3")) {
				this.maxDeadline = 6;
				this.minDeadline = 3;
			} else if (term.equals("4")) {
				this.maxDeadline = 12;
				this.minDeadline = 6;
			} else if (term.equals("5")) {
				this.maxDeadline = 12;
				this.minDeadline = null;
			} else if (term.equals("6")) {
				this.maxDeadline = null;
				this.minDeadline = 12;
			} else if (term.equals("7")) {
				this.maxDeadline = 24;
				this.minDeadline = 12;
			} else if (term.equals("8")) {
				this.maxDeadline = 24;
				this.minDeadline = null;
			} else if (term.equals("9")) {
				this.maxDeadline = null;
				this.minDeadline = 24;
			}
		}
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getTerm() {
		return term;
	}

	public void setTerm(String term) {
		this.term = term;
	}

	public String getMaxDate() {
		return maxDate;
	}

	public void setMaxDate(String maxDate) {
		this.maxDate = maxDate;
	}

	public Integer getMinDeadline() {
		return minDeadline;
	}

	public void setMinDeadline(Integer minDeadline) {
		this.minDeadline = minDeadline;
	}

	public Integer getMaxDeadline() {
		return maxDeadline;
	}

	public void setMaxDeadline(Integer maxDeadline) {
		this.maxDeadline = maxDeadline;
	}

	public Integer getFront() {
		return front;
	}

	public void setFront(Integer front) {
		this.front = front;
	}



}
